<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use dosamigos\datetimepicker\DateTimePicker;
use common\helper\HashHelper;
$time = time();
$key = HashHelper::getUploadHash($time);
/* @var $this yii\web\View */
/* @var $model common\models\TryAdv */
/* @var $form yii\widgets\ActiveForm */
?>
<style>
.field-tryadv-recommend_time .input-group{width:300px;}
.field-tryadv-type{width:300px;}
.field-tryadv-status{width:300px;}
</style>
<div class="try-adv-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'type')->dropDownList(['1'=>'大试特试','2'=>'先试后买','3'=>'试用报告']) ?>

    <?= $form->field($model, 'adv_name')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'pic')->widget('yidashi\webuploader\WebBatchUploader',['server'=>common\helper\UrlManager::createUrl(Yii::$app->params['domains']['upload'],['upload/webupload','time'=>$time,'key'=>$key]),'options'=>['number'=>1]]) ?>

    <?= $form->field($model, 'url')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'status')->dropDownList([ '不显示', '显示']) ?>

    <?= $form->field($model, 'recommend_time')->widget(DateTimePicker::className(), 
        [
        'template'=>"{input}{reset}{button}",
        'clientOptions' => [
            'autoclose' => true,
            'linkFormat' => 'yyyy-MM-dd', // if inline = true
            //'format' => 'yyyy-mm-dd', // if inline = false
            'todayBtn' => true,
            'pickerPosition'=>"bottom-left",
            'language'=>'zh-CN',
            'minView'=>'hour'
        ]    
    ]) ?>

    <div class="form-group">
        <?= $model->isNewRecord ? $form->field($model, 'add_time')->hiddenInput(['value'=>date('Y-m-d H:i:s')])->label(false) : '' ?>
        <?= $model->isNewRecord ? $form->field($model, 'add_user')->hiddenInput(['value'=>Yii::$app->session['admin_name']])->label(false)  : '' ?>
        <?= Html::submitButton($model->isNewRecord ? '新建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
